#include <vector>
#include <string>
#include <stdio.h>
using namespace std;

#ifndef _TWADHOC_
#define _TWADHOC_

typedef struct {
	unsigned char byte1;
	unsigned char byte2;
	unsigned char byte3;
	unsigned char byte4;
	unsigned char byte5;
	unsigned char byte6;
}macadr;

class twAdhocPSP
{
public:
	twAdhocPSP(string name, macadr mac);
	virtual ~twAdhocPSP() {}

	string getName();
	macadr getMac();
	char* getMacStr();
	int getState();

	//void setName(char* name);
	//void setMac(char mac[6]);
	void setState(unsigned int state);
private:
	char* macToString(macadr mac);
	
	string	m_name;
	macadr	m_mac;
	int		m_state;
};

class twAdhocPSPMgr
{
public:
	~twAdhocPSPMgr() {}

	static twAdhocPSPMgr& getInstance()
	{
		static twAdhocPSPMgr m_Inst;
		return m_Inst;
	}

	bool addPSP(macadr mac, string name);

	void removePSP(macadr mac);
	void removePSP(string name);

	twAdhocPSP* getPSP(macadr mac);
	twAdhocPSP* getPSP(string name);
	
	void deleteAll();
private:
	twAdhocPSPMgr() {}
	
	bool compareMac(macadr mac1, macadr mac2);

	vector<twAdhocPSP> m_vecPSP;
};

class twAdhoc
{
public:
	twAdhoc() { m_matchingId = 0; m_pdpId = 0; loadingstage = 0; if(loadMods()){ init(); } }
	~twAdhoc() { unInit(); }

private:
	bool init();
	bool unInit();
	bool loadMods();
	
	int loadingstage;
	
	int m_matchingId;
	int m_pdpId;
};

#endif